package cn.fighter3.service.impl;
import cn.fighter3.dto.QueryDTO;
import cn.fighter3.entity.Iplog;
import cn.fighter3.entity.User;
import cn.fighter3.mapper.IplogMapper;
import cn.fighter3.service.IplogService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IplogServiceImpl implements IplogService {
    @Autowired
    private IplogMapper iplogMapper;

//    @Override
//    public IPage<User> selectUserPage(QueryDTO queryDTO) {
//        Page<User> page=new Page<>(queryDTO.getPageNo(),queryDTO.getPageSize());
//        return userMapper.selectUserPage(page,queryDTO.getKeyword());
//    }
//
//    @Override
//    public Integer addUser(User user) {
//        return userMapper.insert(user);
//    }

    @Override
    public IPage<Iplog> selectIplogPage(QueryDTO queryDTO) {
        Page<Iplog> page=new Page<>(queryDTO.getPageNo(),queryDTO.getPageSize());
        return iplogMapper.selectIplogPage(page,queryDTO.getKeyword());
    }

    @Override
    public Integer addIplog(Iplog iplog) {
        return iplogMapper.insert(iplog);
    }

    @Override
    public Integer deleteIplog(Integer id) {
        return iplogMapper.deleteById(id);
    }

    @Override
    public void batchDelete(List<Integer> ids) {
        iplogMapper.deleteBatchIds(ids);
    }
}
